<?php

error_reporting(E_ALL || E_NOTICE);
session_start();



require "smarty/Smarty.class.php";
require "includes/mysql.class.php";
require "includes/functions.php";
require "includes/config.php";

define('security', 1);

$Template = new Smarty;
$DB = new CMySQL();


$Template->compile_dir = "cache";
$Template->compile_check = true;
$Template->debugging = false;

$Template->assign('page_title', $conf['title']);

$includes = array(
    'default' => 'manager.php',
    'login' => 'login.php',
    'logout' => 'logout.php',
    'option' => 'option.php',
    'manager' => 'manager.php',
    'cron' => 'cron.php'
);

if (isset($_SESSION['islogin']) && $_SESSION['islogin'] == 1) {
    if (!isset($_GET['act']) || empty($_GET['act']) || !isset($includes[$_GET['act']])) {
        $action = 'default';
    }
    else {
        $action = $_GET['act'];
    }
}
else {
    $action = 'login';
}


$Template->display("index.html");
$Template->display("menu.html");

include 'includes/' . $includes[$action];

$Template->display("footer.html");
?>